package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.DeviceDto;
import com.zzyl.dto.DevicePageQueryDto;
import com.zzyl.entity.Device;
import com.zzyl.entity.DeviceData;
import com.zzyl.vo.DeviceDataGraphVo;
import com.zzyl.vo.DeviceVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface DeviceMapper {

    DeviceVo queryByDeviceName(String deviceName);

    void insert(Device device);

    Page<DeviceVo> pageQueryDevice(DevicePageQueryDto devicePageQueryDto);

    DeviceVo queryDeviceDetail(Device device);

    void updateDevice(Device device);

    void deleteById(String iotId);

    DeviceVo selectByIotId(String iotId);

    void insertDeviceData(List<DeviceData> deviceDataList);

    List<DeviceDataGraphVo> queryDeviceDataListByDay(String iotId, String functionId, LocalDateTime startDate, LocalDateTime endDate);

    List<DeviceDataGraphVo> queryDeviceDataListByWeek(String iotId, String functionId, LocalDateTime startDate, LocalDateTime endDate);

    List<Long> selectNursingIdsByIotIdWithElder(String iotId);

    List<Long> selectNursingIdsByIotIdWithBed(String iotId);

    List<Long> selectUserIdsByRoleName(String deviceMaintainerRole);
}